package com.godtree.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.godtree.entity.User;
import com.godtree.service.UserService;
import com.opensymphony.xwork2.ActionSupport;
@Controller
@Namespace("/user")
@Results(@Result(name = "list", type = "redirect", location = "list.action"))
public class UserAction extends ActionSupport{
private User user;
@Autowired
private UserService userService;

public User getUser() {
	return user;
}

public void setUser(User user) {
	this.user = user;
}

@Action("add")
public String add() {
	userService.addUser(user);
	return "user-add-success";
}

}
